function init(){
  password_check();
}

function password_check(){
  var pass1 = document.getElementById("new_pass1").value;
  var pass2 = document.getElementById("new_pass2").value;
  var submit = document.getElementById("pass_submit");
  var pass_flag = document.getElementById("pass_flag");
  var reason = document.getElementById("pass_reason");
  
  if(pass1 == '' && pass2 == ''){
    pass_flag.innerHTML = '';
    reason.innerHTML = '';
    submit.disabled = true;
  }
  else if(pass1 == ''){
    pass_flag.innerHTML = '<img src="../layout/password_no.jpg" />';
    reason.innerHTML = 'Please enter a password in both fields.';
    submit.disabled;
  }
  else if(pass1 != pass2){
    pass_flag.innerHTML = '<img src="../layout/password_no.jpg" />';
    reason.innerHTML = 'Passwords do not match.';
    submit.disabled = true;
  }
  else if(pass1 == pass2){
    if(pass1.length < 5){
      pass_flag.innerHTML = '<img src="../layout/password_no.jpg" />';
      reason.innerHTML = 'Password too short.';
      submit.disabled = true;
    }
    else{
      pass_flag.innerHTML = '<img src="../layout/password_yes.jpg" />';
      reason.innerHTML = '';
      submit.disabled = false;
    }
  }
}